<div class="navigation">
    <a href="/">Главная</a>&nbsp;&nbsp;/&nbsp;&nbsp;<a href="<?= Yii::app()->controller->createUrl('/about'); ?>" class="nav_active"><?= $oContent->page_title; ?></a>
</div>

<div>
    <h1 class="zag"><?= $oContent->page_title; ?></h1>
    <div class="line"> </div>
    <?= $oContent->page_text; ?>
    <br />
    <div style="float: right;">Сегодня: <?= date('d-m-Y'); ?></div>
    <h3>Средний курс - ПРОДАЖА</h3>
    <br />
    <table width="30%" style="width: 30%;">
        <?php foreach($aAvgRateSale as $aStatItem):?>
            <tr>
                <td width="10%" style="width: 10%" align="left"><?= Lot::getCurrencySymbol($aStatItem['currency']);?>&nbsp;</td>
                <td width="10%" style="width: 10%;" align="right">
                    <?= number_format($aStatItem['avg_rate'], 0, '.', ' ');?>
                </td>
                <td width="10%" style="width: 10%;" align="right">
                    <?php if(floatval($aStatItem['avg_rate']) > 0 && isset($aAvgRateSaleYesterday[$aStatItem['currency']])):?>
                        <?php $iDiff = round((($aStatItem['avg_rate'] - $aAvgRateSaleYesterday[$aStatItem['currency']]['avg_rate_yesterday']) / $aStatItem['avg_rate']) * 100); ?>
                        <?php if($iDiff > 0): ?>
                        <span style="color: #2A8215;">+<?= $iDiff;?>%</span>
                        <?php elseif($iDiff < 0):?>
                        <span style="color: #DB0001;"><?= $iDiff;?>%</span>
                        <?php else:?>
                        <span>0%</span>
                        <?php endif;?>
                    <?php else:?>
                    <span>0%</span>
                    <?php endif;?>
                </td>
            </tr>
        <?php endforeach;?>

    </table>
    <br />
    <h3>Средний курс - ПОКУПКА</h3>
    <br />
    <table width="30%" style="width: 30%;">

        <?php foreach($aAvgRatePurchase as $aStatItem):?>
            <tr>
                <td width="10%" style="width: 10%" align="left"><?= Lot::getCurrencySymbol($aStatItem['currency']);?>&nbsp;</td>
                <td width="10%" style="width: 10%;" align="right">
                    <?= number_format($aStatItem['avg_rate'], 0, '.', ' ');?>
                </td>
                <td width="10%" style="width: 10%;" align="right">
                    <?php if(floatval($aStatItem['avg_rate']) > 0 && isset($aAvgRatePurchaseYesterday[$aStatItem['currency']])):?>
                        <?php $iDiff = round((($aStatItem['avg_rate'] - $aAvgRatePurchaseYesterday[$aStatItem['currency']]['avg_rate_yesterday']) / $aStatItem['avg_rate']) * 100); ?>
                        <?php if($iDiff > 0): ?>
                        <span style="color: #2A8215;">+<?= $iDiff;?>%</span>
                        <?php elseif($iDiff < 0):?>
                        <span style="color: #DB0001;"><?= $iDiff;?>%</span>
                        <?php else:?>
                        <span>0%</span>
                        <?php endif;?>
                    <?php else:?>
                    <span>0%</span>
                    <?php endif;?>
                </td>
            </tr>
        <?php endforeach;?>

    </table>
    <br />
    <h3>Совокупный СПРОС</h3>
    <br />
    <table width="30%" style="width: 30%;">
        <?php foreach($aSumCurrencyPurchase as $aStatItem):?>
            <tr>
                <td width="10%" style="width: 10%" align="left"><?= Lot::getCurrencySymbol($aStatItem['currency']);?>&nbsp;</td>
                <td width="25%" style="width: 25%;" align="right">
                    <?= number_format($aStatItem['sum_currency'], 0, '.', ' ');?>
                </td>
                <td width="5%" style="width: 5%;" align="right">
                    <?php if(floatval($aStatItem['sum_currency']) > 0 && isset($aSumCurrencyPurchaseYesterday[$aStatItem['currency']])):?>
                        <?php $iDiff = round((($aStatItem['sum_currency'] - $aSumCurrencyPurchaseYesterday[$aStatItem['currency']]['sum_currency_yesterday']) / $aStatItem['sum_currency']) * 100); ?>
                        <?php if($iDiff > 0): ?>
                        <span style="color: #2A8215;">+<?= $iDiff;?>%</span>
                        <?php elseif($iDiff < 0):?>
                        <span style="color: #DB0001;"><?= $iDiff;?>%</span>
                        <?php else:?>
                        <span>0%</span>
                        <?php endif;?>
                    <?php else:?>
                    <span>0%</span>
                    <?php endif;?>
                </td>
            </tr>
        <?php endforeach;?>

    </table>
    <br />
    <h3>Совокупное ПРЕДЛОЖЕНИЕ</h3>
    <br />
    <table width="30%" style="width: 30%;">
        <?php foreach($aSumCurrencySale as $aStatItem):?>
            <tr>
                <td width="10%" style="width: 10%" align="left"><?= Lot::getCurrencySymbol($aStatItem['currency']);?>&nbsp;</td>
                <td width="25%" style="width: 25%;" align="right">
                    <?= number_format($aStatItem['sum_currency'], 0, '.', ' ');?>
                </td>
                <td width="5%" style="width: 5%;" align="right">
                    <?php if(floatval($aStatItem['sum_currency']) > 0 && isset($aSumCurrencySaleYesterday[$aStatItem['currency']])):?>
                        <?php $iDiff = round((($aStatItem['sum_currency'] - $aSumCurrencySaleYesterday[$aStatItem['currency']]['sum_currency_yesterday']) / $aStatItem['sum_currency']) * 100); ?>
                        <?php if($iDiff > 0): ?>
                        <span style="color: #2A8215;">+<?= $iDiff;?>%</span>
                        <?php elseif($iDiff < 0):?>
                        <span style="color: #DB0001;"><?= $iDiff;?>%</span>
                        <?php else:?>
                        <span>0%</span>
                        <?php endif;?>
                    <?php else:?>
                    <span>0%</span>
                    <?php endif;?>
                </td>
            </tr>
        <?php endforeach;?>

    </table>

</div>